/**
 *  iBizSys 5.0 机器人生产代码（不要直接修改当前代码）
 *  http://www.ibizsys.net
 */
package com.sa.ibiz.demo.srv.codelist;


import net.ibizsys.paas.codelist.CodeItem;
import net.ibizsys.paas.codelist.CodeItems;
import net.ibizsys.paas.codelist.CodeList;
import net.ibizsys.paas.sysmodel.StaticCodeListModelBase;
import net.ibizsys.paas.sysmodel.CodeListGlobal;

import net.ibizsys.paas.sysmodel.DynamicCodeListModelBase;
import net.ibizsys.paas.db.DBFetchResult;
import net.ibizsys.paas.core.DEDataSetFetchContext;
import net.ibizsys.paas.demodel.DEModelGlobal;
import net.ibizsys.paas.demodel.IDataEntityModel;
import net.ibizsys.paas.service.IService;
import net.ibizsys.paas.service.ServiceGlobal;

import com.sa.ibiz.demo.srv.demo.service.IBZ5ORDERTYPEService;
import com.sa.ibiz.demo.srv.demo.demodel.IBZ5ORDERTYPEDEModel;

@CodeList(id="41196635-EF91-4501-91A1-F1D3D5E1F10F",name="订单类型",type="DYNAMIC",userscope=false,emptytext="未定义")

@CodeItems({
})



/**
 * 动态代码表[订单类型]模型类
 */
public class ORDERTYPECodeListModel extends com.sa.ibiz.demo.srv.codelist.MyTestSysDynamicCodeListModelBase  {


    public ORDERTYPECodeListModel() {
        super();
        this.initAnnotation(ORDERTYPECodeListModel.class);
        this.setTextField("IBZ5ORDERTYPENAME");
        this.setValueField("IBZ5ORDERTYPEID");
        this.setDSCondition("");
        CodeListGlobal.registerCodeList("com.sa.ibiz.demo.srv.codelist.ORDERTYPECodeListModel", this);
    }

    private IBZ5ORDERTYPEDEModel iBZ5ORDERTYPEDEModel;

    /**
     * 获取实体[IBZ5ORDERTYPE]模型对象
     */
    public  IBZ5ORDERTYPEDEModel getIBZ5ORDERTYPEDEModel() {
        if(this.iBZ5ORDERTYPEDEModel==null) {
            try {
                this.iBZ5ORDERTYPEDEModel = (IBZ5ORDERTYPEDEModel)IBZ5ORDERTYPEDEModel.getInstance();
            } catch(Exception ex) {
            }
        }
        return this.iBZ5ORDERTYPEDEModel;
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.sysmodel.DynamicCodeListModelBase#getDEModel()
     */
    @Override
    protected IDataEntityModel getDEModel() {
        return this.getIBZ5ORDERTYPEDEModel();
    }

    private IBZ5ORDERTYPEService iBZ5ORDERTYPEService;

    /**
     * 获取实体[IBZ5ORDERTYPE]实际服务对象
     */
    public  IBZ5ORDERTYPEService getRealService() {
        if(this.iBZ5ORDERTYPEService==null) {
            try {
                this.iBZ5ORDERTYPEService = (IBZ5ORDERTYPEService)IBZ5ORDERTYPEService.getInstance(this.getSessionFactory());
            } catch(Exception ex) {
            }
        }
        return this.iBZ5ORDERTYPEService;
    }

    /* (non-Javadoc)
    * @see net.ibizsys.paas.sysmodel.DynamicCodeListModelBase#getService()
    */
    @Override
    protected IService getService() {
        return getRealService();
    }

    /* (non-Javadoc)
     * @see net.ibizsys.paas.sysmodel.DynamicCodeListModelBase#onPrepareCodeItems()
     */
    @Override
    protected void onPrepareCodeItems() throws Exception {
        DEDataSetFetchContext deDataSetFetchContextImpl = new DEDataSetFetchContext(null);
        deDataSetFetchContextImpl.setSort(this.getMinorSortField());
        deDataSetFetchContextImpl.setSortDir(this.getMinorSortDir());
        fillFetchConditions(deDataSetFetchContextImpl);
        DBFetchResult fetchResult = this.getRealService().fetchDefault(deDataSetFetchContextImpl);
        fillFetchResult(fetchResult.getDataSet().getDataTable(0));
    }
}